<?php

class DesignTimeWorkflowParallelSplitWithForeachableDecorator extends AbstractDesignTimeWorkflowDecorator
{
  
  /**
   * @var DesignTimeWorkflowParallelSplitWithForeachableDecorator
   */
  protected $split_node;

  /**
   * @param DesignTimeWorkflow $decoratee
   */
  public function __construct (DesignTimeWorkflow $decoratee, DesignTimeWorkflowParallelSplitWithForeachableNode $split_node)
  {
    parent::__construct($decoratee);
    $this->split_node = $split_node;
  }

  /**
   * @param string $identifier
   */
  public function endWithSynchronization ($identifier = 'synchronization')
  {
    $node = new DesignTimeWorkflowSynchronizationNode($identifier, $this->split_node);
    $this->followedBy($node);
    
    return $this->getDecoratee();
  }
}